<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\External;
use App\Http\Controllers\ExternalJwtController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::post('/getExternalToken', [ExternalJwtController::class, 'getAuthToken'])->withoutMiddleware(['external_jwt']); //获取token,->withoutMiddleware([CheckExternalJwtHeaderToken::class])排除这个中间件，因为在路由服务中间件中，自动运用了这个中间件

//不需要token
Route::prefix('external')->group(function () {

    Route::post('/index/getScoreByAccount', [External\IndexController::class, 'getScoreByAccount']); // 根据读者证获取积分
    Route::post('/index/consumeScoreByAccount', [External\IndexController::class, 'consumeScoreByAccount']); // 根据读者证号消耗积分
    Route::post('/index/returnScoreByAccount', [External\IndexController::class, 'returnScoreByAccount']); // 根据读者证号返还积分
    Route::post('/index/getReaderInfo', [External\IndexController::class, 'getReaderInfo']); // 获取绑定的读者证信息


    Route::post('/aiIntellect/getAiResourceList', [External\AiIntellectController::class, 'getAiResourceList']); // 获取资源用于AI检索
    Route::post('/aiIntellect/getAiResourceDetail', [External\AiIntellectController::class, 'getAiResourceDetail']); // 获取资源用于AI检索,获取详情




});

//token必选
Route::middleware(['check.external.token'])->prefix('external')->group(function () {});

//token可选
Route::middleware(['check.may.external.token'])->prefix('external')->group(function () {});
